<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="/tld/dictionary" prefix="dictionary"%>
<%@ taglib uri="/tld/flowdictionary" prefix="flowdictionary"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link rel="stylesheet" href="${ctx}/static/css/style.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/style1.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/kongjian.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/jquery.ui.all.css" />
<script src="${ctx}/static/script/jquery-1.4.min.js" type="text/javascript"></script>
<script src="${ctx}/static/script/jquery.ui.core.js"></script>
<script src="${ctx}/static/script/jquery.ui.datepicker.js"></script>
<script src="${ctx}/static/script/js_validator.js"></script>
<script type="text/javascript" src="${ctx}/static/script/jquery.blockUI.js"></script>
 <title>卖单管理</title>
</head>
<script language="JavaScript">
function jumpPage(pageNo) {
	document.getElementById('pageNo').value=pageNo;
	document.getElementById('mainForm').submit();
}


//function _submit(id,action){
//	var thisform = document.getElementById('mainForm');
//	thisform.action =action;//'${ctx}/order/sell_order_execute?id=${item.id}';
//	thisform.submit();
//}

function submit_(id,mark,action){
	window.location.href=action+"?sellOrderId="+id+"&mark="+mark;
}

function add_sell_order(){
var thisform = document.getElementById('mainForm');
thisform.action = '${ctx}/sellOrder/sell_order_init';
thisform.submit();
}

$(document).ajaxStop($.unblockUI); 
function replySellOrder(sellorderId){
	var isTrue = confirm('确定要撤单吗？');
	if(isTrue==false){
		return ;
	}
	$.blockUI({ message: '<div><img src="${ctx}/static/images/busy.gif" /><font size="4px"> Just a moment...</font></div>' }); 
	$.get("${ctx}/sellOrder/reply_sell_order?sellOrderId="+sellorderId, function(data) {
		if(data.errorMsg!=null){
			alert(data.errorMsg);
		}
		var thisform = document.getElementById('mainForm');
		thisform.submit();
	});
}
</script>
<body>
<form:form id="mainForm" action="${ctx}/sellOrder/sell_order_list" modelAttribute="sellOrderMainFormList" method="post">
<input type="hidden" name="pageNo" id="pageNo" value="${page.pageNo}"/>
<div class="er_banner">卖单管理</div>
   <div class="shenqing2">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
            <td width="61">客户编号：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" id="customerId" name="customerId" value="${sellOrderMainFormList.customerId}" class="ggkj_inputtext_80" /></td>
            <td width="85">客户姓名：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" id="customerName" name="customerName" value="${sellOrderMainFormList.customerName}"  class="ggkj_inputtext_80"  />
            </td>
			<td width="85">投资编号：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" id="investId" name="investId" value="${sellOrderMainFormList.investId}"  class="ggkj_inputtext_80"  />
            </td>
			<td width="85">卖单编号：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" id="sellOrderId" name="sellOrderId" value="${sellOrderMainFormList.sellOrderId}"  class="ggkj_inputtext_80"  />
			 <td width="93"><input name="Input" type="submit" class="chaxun_btn" value="&nbsp;&nbsp;查询" />
             </td>
          </tr>
      </table>
    </div>
	<div clas="yiban" style="text-align:left;padding-left:3px;margin-top:10px;">
		<p><a href="#" class="ggkj_btnNormal1" >
			<span class="ggkj_btnNormal_span">
			<input name="" type="button" value="添加卖单 " class="ggkj_btnInner1" onclick="add_sell_order();"/></span>
		</a>
		</p>
  </div>
<div class="yiban">
	<table style="width:100%;" class="ggkj_table"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th scope="col">序号</th>
    <th scope="col">卖单编号</th>
    <th scope="col">投资编号</th>
    <th scope="col">客户编号</th>
    <th scope="col">姓名</th>
    <th scope="col">约定对价</th>
    <th scope="col">已收款</th>
    <th scope="col">约定交割日</th>
    <th scope="col">手续费</th>
    <th scope="col">补偿金</th>
	<th scope="col">尽快转让</th>
    <th scope="col">申请日期</th>
	<th scope="col">状态</th>
    <th scope="col">操作</th>
  </tr>
  </tr>
  	<c:forEach items="${page.result}" var="item" varStatus="stauts">
  			<c:if test="${stauts.count%2==0}">
  				<tr class="ggkj_tdColr">
  			</c:if>
  			<c:if test="${stauts.count%2!=0}">
  				<tr >
  			</c:if>
		<td>${stauts.count+(page.pageNo-1)*10}</td>
		<td>
		<a href="#" onclick="submit_('${item.id}','detail','${ctx}/sellOrder/sellorder_detail')">${item.id}</a>
		</td>
		<td>${item.investInfo.id}</td>
		<td>${item.investInfo.customerInfo.customerCode}</td>
		<td>${item.investInfo.customerInfo.cnName}</td>
		<td><fmt:formatNumber value="${item.sellOrderAmt}" pattern="##,###.##"/></td>
		<td><fmt:formatNumber value="${item.receiveAmt}"  pattern="#0.0#"/></td>
		<td>
			<fmt:formatDate value="${item.appointPaymentDate}"   pattern="yyyy-MM-dd" type="date" dateStyle="long" />
		</td>
		<td>0</td>
		<td>0</td>
		<td>
		<c:if test="${item.isExpress==1}">
			是
		</c:if>
		<c:if test="${item.isExpress==0}">
			否
		</c:if>
		</td>
		<td>
			<fmt:formatDate value="${item.createDate}"   pattern="yyyy-MM-dd" type="date" dateStyle="long" />
		</td>
		<td>
			<flowdictionary:display code="${item.flowId}" />
		</td>
			<td>
		<c:if test="${item.flowId=='04000002'}">
			<a href="#" onclick="replySellOrder(${item.id});">撤单</a>
			| 
			<c:if test="${item.investInfo.id!='1'&& item.investInfo.id!='2'}">
			<a href="#" onclick="submit_('${item.id}','centerManBuy','${ctx}/sellOrder/sellorder_detail');">居间人购买</a>
			</c:if>
			 <c:if test="${item.investInfo.id=='1'|| item.investInfo.id=='2'}">
			居间人购买
			</c:if>
		</c:if>
		<c:if test="${item.flowId!='04000002'}">
			撤单|居间人购买
		</c:if>
			</td>
		</tr>
	</c:forEach>
</table>
	
</div>
<div class="ggkj_pagecontainer">
  <div class="ggkj_pageBGleft">
    	<span class="ggkj_pageBGright"></span>
    	<a href="javascript:jumpPage(1)" class="ggkj_pageUpa">
        
        </a>
        <a href="javascript:jumpPage(${page.prePage})" class="ggkj_pageUp">
        
        </a>
        <span class="ggkj_insertline"></span>
        <span class="ggkj_pageSpan">
        	页<input type="text" id="pageNo" name="pageNo" class="ggkj_inputtext_30" value="${page.pageNo}">OF ${page.totalPages}
        </span>
        <span class="ggkj_insertline"></span>
        <a href="javascript:jumpPage(${page.nextPage})" class="ggkj_pageDown">
        
        </a>
        <a href="javascript:jumpPage(${page.totalPages})" class="ggkj_pageDowna">
        
        </a>
        <span class="ggkj_insertline"></span>
        
    </div>
</div>

</form:form>
</body>
</html>
